<template>
	<view class="pad-16r">
		<!-- 		我的收藏 -->
		<view v-for="(item,index) in dataSource">
			<view class="item" @click="toPage(item)">
				<view class="left">
					<view class="over-2">
						{{item.name}}
					</view>
					<view class="between color-gray">
						<view>浏览 {{item.times||0}}</view>
						<view>点赞 {{item.likes||0}}</view>
						<view>收藏 {{item.collects||0}}</view>
						<view>转发 {{item.forwards||0}}</view>
					</view>
				</view>
				<view v-if="item.subName">
					<image class="img" :src="hostApi+item.subName"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
	} from 'vuex';
	import {
		noticeLikeSelect
	} from '../../api/noticeLike';
	export default {
		data() {
			return {
				dataSource: [],
			}
		},
		computed: {
			...mapGetters([
				'userInfo', 'hostApi'
			])
		},
		mounted() {
			this.init()
		},
		methods: {
			init() {
				noticeLikeSelect({
					patId: this.userInfo.patId,
					status: 1
				}).then(res => {
					console.log(res);
					this.dataSource = res;
				})
			},
			toPage(item) {
				uni.navigateTo({
					url: `/pages/Home/Notice/detail?item=` + JSON.stringify(item)
				})
			},
		}
	}
</script>

<style scoped>
	.item {
		display: flex;
		justify-content: flex-start;
		padding: 10px;
		border-bottom: 1px solid rgb(237, 242, 250);
		margin: 10px 0;
		background-color: white;
		border-radius: 10px;
	}

	.left {
		flex: 1;
		padding: 0 10px;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.img {
		padding: 10px 0;
		width: 100px;
		height: 50px;
	}
</style>